package nowCoder;

import java.util.Scanner;

public class HJ55 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int num = 0;
        for (int i = 1; i <= n; i++) {
            if (i % 7 == 0){
                num++;
                continue;
            }
            int m = i;
            while(m > 0){
                if (m % 10 == 7){
                    num++;
                    break;
                }
                m = m / 10;
            }
        }
        System.out.println(num);
    }
}
